<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
	<script type="text/javascript">
	//html里怎么写,js里就怎么写
         function setColor(color){
                  var oDiv=document.getElementById("div1");
                  oDiv.style.background=color;
         }
	</script>
	<style type="text/css">
      #div1{
      	width:200px;height:200px;
      	background-color:red;
      }
	</style>
</head>
<body>
   <input type="button" value="变绿" onclick="setColor('green')">
   <input type="button" value="变红" onclick="setColor('red')">
   <input type="button" value="变黄" onclick="setColor('yellow')">
   <div id="div1">45</div>
</body>
</html>